package model

import (
	uuid "github.com/satori/go.uuid"
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	UUID      uuid.UUID `json:"uuid" gorm:"index;comment:用户UUID"`
	Username  string    `json:"username" gorm:"varchar(20);not null;unique;comment:用户名"`
	Telephone string    `json:"telephone" gorm:"varchar(11)not null;unique;comment:手机号"`
	Password  string    `json:"password" gorm:"size:255;not null;comment:密码"`
	Nickname  string    `json:"nickname" gorm:"size:255;not null;comment:昵称"`
	Email     string    `json:"email" gorm:"size:255;comment:邮箱"`
	Avatar    string    `json:"avatar " gorm:"default:tt_avatar.jpg;comment:用户头像"`
	Role      int       `json:"role" gorm:"not null;comment:账号角色"`   //0(超级管理员) / 1(管理员) / 2(员工)
	Status    int       `json:"status" gorm:"not null;comment:账号状态"` // 0(正常) / 1(禁用) / 2(删除)
	IsOnline  bool      `json:"isOnline" gorm:"not null;comment:在线状态"`
}

func (User) TableName() string {
	return "sys_users"
}
